package com.gxg.controller;

import com.gxg.services.JudgeServerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * By 李朋飞
 **/
@RestController
public class JudgeServerController {

    @Autowired
    JudgeServerService judgeServerService;

    @PostMapping("/judgeByString")
    public String judgeByString(@RequestParam("content") String content,@RequestParam("type") String type){
        return judgeServerService.judgeServer(content,type);
    }
    @PostMapping("/upload")
    public String judgeByFile(@RequestParam("file") MultipartFile file) throws IOException {
        return judgeServerService.judgeServerByFile(file);
    }
}
